package top.hjcwzx.wrench.limiter.strategy.key.impl;

import top.hjcwzx.wrench.limiter.strategy.key.RateLimiterKeyStrategy;

import java.lang.reflect.Method;

//普通key
public class CommonKeyStrategy implements RateLimiterKeyStrategy {
    @Override
    public String generateKey(Method method, Object[] args, Object target, String keyExpr) {
        if (keyExpr == null || keyExpr.trim().isEmpty()) {
            return method.getDeclaringClass().getName() + "." + method.getName();
        }
        // 直接返回字符串，或者做个简单替换也行
        return keyExpr;
    }
}
